<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<script>
  window.onload = function(){
    let text1 = document.querySelector("#text1")
    let btn1 = document.querySelector("#btn1")
    btn1.onclick = function(){
      let newWin = window.open("about:blank","_blank")
      newWin.document.write(text1.value)
    }

  }
</script>
<body>
  <textarea id="text1"></textarea>
  <br>
  <input id="btn1" type="button" value="运行">
  
</body>
</html>